Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
TextureInfo.setTexture() tagged every texture as sRGB except the metallic-roughness, normal and occlusion maps. The clearcoat, clearcoat roughness, clearcoat normal, sheen roughness, transmission, thickness, specular, iridescence, iridescence thickness and anisotropy slots hold non-color data, so a texture set on one of them was decoded as sRGB and rendered differently from the same image loaded with the model. Set those slots to linear, as GLTFLoader does. Base color, emissive, sheen color and specular color stay sRGB.
HEOJUNFO
force-pushed
the
fix-extension-texture-color-space
branch
from
December 1, 2026 10:54
a6a9718 to
220221e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issue
None. Found while reading
TextureInfo.setTexture().Description
A texture set on a non-color extension slot through the scene-graph API is sampled as sRGB, so the material renders differently from the same image referenced by the glTF.
createTexture()returns an sRGB texture (scene-graph.tsL134).TextureInfo.setTexture()starts from sRGB (texture-info.tsL137) and switches to linear only for the metallic-roughness, normal and occlusion slots. These ten slots keep sRGB:clearcoatTexture,clearcoatRoughnessTexture,clearcoatNormalTexture,sheenRoughnessTexture,transmissionTexture,thicknessTexture,specularTexture,iridescenceTexture,iridescenceThicknessTexture,anisotropyTexture.To measure it I loaded
ClearCoatTest.gltffrom glTF-Sample-Assets and set the model's own images again on the slots they already use (PartialCoating.pngonclearcoatTexture,RoughnessStripes.pngonclearcoatRoughnessTexture,PlasticWrap_normals.jpgandRibsNormal.pngonclearcoatNormalTexture). The frame should stay the same.setTexture()Fix
Set those ten slots to
LinearSRGBColorSpace, the way the three existing data slots do. This matches GLTFLoader, which passesSRGBColorSpaceonly for base color, emissive, sheen color and specular color. Those four stay sRGB.sheenRoughnessTextureandspecularTextureare read from the alpha channel, so for them only the tag changes.Tests
Added
setTexture sets the color space the slot expectstotexture-info-spec.ts. On master it fails withclearcoatTexture: expected 'srgb' to equal 'srgb-linear'.specularColorTextureis not in the test. Its getter returns the sheen color slot (material.tsL567), which is a separate fix.Ran on Chromium (headless, SwiftShader) with the options of
web-test-ci.config.mjs:eslinton the two changed files reports no errors. I did not run WebKit or Firefox.🤖 Generated with Claude Code